// run: $exec < input
#include <iostream>
#include <string>

int t;
std::string s;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> t >> s;
	std::cin >> s;
	int ans = 0;
	if (s[0] == 'w') {
		int now = 5;
		for (int i = 0; i < 366; i++) {
			if (now == t) ans++;
			now++;
			if (now == 8) now = 1;
		}
	} else {
		if (t <= 29) ans = 12;
		else if (t <= 30) ans = 11;
		else ans = 7;
	}
	std::cout << ans << "\n";
}

